<?php

class Form extends CI_Controller {
 
 function index()
 {
  $this->load->helper(array('form', 'url'));
  
  $this->load->library('form_validation');
   
  $this->form_validation->set_rules('username', '用户名', ' trim |required|min_length[5]|max_length[12]| xss_clean ');
$this->form_validation->set_rules('password', '密码', ' trim |required|matches[passconf]| md5 ');
$this->form_validation->set_rules('passconf', '确认密码', ' trim |required');
$this->form_validation->set_rules('email', '电子邮件', ' trim |required|valid_email');  
  
  if ($this->form_validation->run() == FALSE)
  {
   $this->load->view('myform');
  }
  else
  {
   $this->load->view('formsuccess');
  }
 }
}